from selenium.webdriver.common.by import By

from base.base_page import BasePage


class PageEmpAdd(BasePage):
    # 实列化属性
    def __init__(self):
        super().__init__()
        # 点击添加员工按钮
        self.add_emp_btn =(By.XPATH, "//span[contains(text(),'添加员工')]")
        # 输入员工账号
        self.emp_username =(By.CSS_SELECTOR, "input[placeholder*='账号']")
        # 输入员工姓名
        self.emp_name = (By.CSS_SELECTOR, "input[placeholder='请输入员工姓名']")
        # 输入手机号
        self.emp_phone = (By.CSS_SELECTOR, "input[placeholder='请输入手机号']")
        # 输入身份证号
        self.emp_cart_number = (By.CSS_SELECTOR, "input[placeholder='请输入身份证号']")
        # 点击保存按钮
        self.save_btn = (By.XPATH, "//span[contains(text(),'保存')]")

    # 添加员工实例
    def page_add_emp(self):
        # 点击添加员工按钮
        self.base_click(self.add_emp_btn)
        # 输入员工账号
        self.base_input_text(self.emp_username,"zgm")
        # 输入员工姓名
        self.base_input_text(self.emp_name,"朱名广")
        # 输入手机号
        self.base_input_text(self.emp_phone,"13526154268")
        # 输入身份证
        self.base_input_text(self.emp_cart_number,"120101190001010075")
        # 点击保存
        self.base_click(self.save_btn)




